package com.shop.cloud.service.hongfu.impl;


import java.util.List;

import com.shop.cloud.domain.hongfu.UserLevel;
import com.shop.cloud.service.hongfu.IUserLevelService;
import com.shop.cloud.dao.hongfu.UserLevelDao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shop.cloud.common.mybatis.BaseService;
import com.shop.cloud.common.mybatis.MybatisDao;

/**
 * user_level
 */
@Service("userLevelService")
public class UserLevelService extends BaseService<UserLevel> implements IUserLevelService{
    
    @Autowired
	private UserLevelDao userLevelDao;

	@Override
	public MybatisDao<UserLevel> getEntityDao() {
		return userLevelDao;
	}

	public void findIsDefault(UserLevel userLevel) {
		// TODO Auto-generated method stub
		UserLevel usLevel = new UserLevel();
		List<UserLevel> userlList=userLevelDao.findByEntity(usLevel);
		for (UserLevel userLevel2 : userlList) {
			if(userLevel2.getIsDefault()==0){
				
				UserLevel userLevel3 = userLevelDao.get(userLevel2.getId());
				userLevel3.setIsDefault(1);
				userLevelDao.update(userLevel3);
			}
		}
	}


    
}